﻿#region Header

// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

using System;
using Majesty_of_Omega.Properties;

#endregion

namespace Majesty_of_Omega.Config
{
    /// <summary>
    /// This Exception will be raised on errors in the config file
    /// </summary>
    public class SpreadsheetException : Exception
    {
        private readonly SpreadSheetType SpreadSheetType;

        /// <summary>
        /// Initializes a new instance of the <see cref="SpreadsheetException"/> class.
        /// </summary>
        /// <param name="spreadSheetType">Type of the spread sheet.</param>
        /// <param name="message">The exception message.</param>
        public SpreadsheetException(SpreadSheetType spreadSheetType, string message)
            : base(message)
        {
            SpreadSheetType = spreadSheetType;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SpreadsheetException"/> class.
        /// </summary>
        /// <param name="spreadSheetType">Type of the spread sheet.</param>
        /// <param name="message">The message.</param>
        /// <param name="innerException">The inner exception.</param>
        public SpreadsheetException(SpreadSheetType spreadSheetType, string message, Exception innerException)
            : base(message, innerException)
        {
            SpreadSheetType = spreadSheetType;
        }

        /// <summary>
        /// Gets a message that describes the current exception.
        /// </summary>
        /// <returns>The error message that explains the reason for the exception, or an empty string("").</returns>
        public override string Message
        {
            get { return string.Format(Resources.SpreadsheetException_Message_Exception_while_accessing__0___Message___1_, SpreadSheetType, base.Message); }
        }
    }
}